<?php
require_once 'application/library/config/gcConfigRegistry.php';
require_once 'application/library/controller/gcLBasicAction.php';
require_once 'application/modules/example/constant/example_constant_templatName.php';
require_once 'application/library/helper/jsonHelper.php';
require_once 'application/library/exception/gcExceptionDealer.php';
require_once 'application/library/service/commService/gcSequenceService.php';

/**
 * 
 * exampleTreeController
 * @author   Founder
 * @version   1.0
 * @exlcude   作成日:2010/08/11
 */

class example_exampleTreeController extends gcLBasicAction{
    /**
     * 初期表示
     * indexAction 
     * @throws gcException
     * @return
     */
    public function indexAction(){
        try{
            $this->setPageInfo();
            $gcCodeCatch = new gcSequenceService();
            $aa = "aaa";
            echo $gcCodeCatch->getSequence($aa);
            $this->gcView->render(example_constant_templatName::EXAMPLE_TREE);
        }catch (Exception $e){
             gcExceptionDealer::setException($e);
        }
    }
    
    /**
     * updateAction
     * @return
     */
    public function updateAction(){
        if($this->getRequest()->isXmlHttpRequest()){
            $jsonTree = $this->getParam("tree");
            $jsonTree = str_replace("&quot;", "\"", $jsonTree);
            $json = json_decode($jsonTree);
            $json[0]->name = "aaa";
            $output = array("count"      => $json);

            jsonHelper::outPutJson($output);
        }else{
            $output = array("count"      => $jsonTree);
            jsonHelper::outPutJson($output);
        }
    }
    
    /**
     *
     * Enter description here ...
     */
    private function setPageInfo(){
        $this->gcView->title        = $this->getLabel("title");
        $this->gcView->update        = $this->getLabel("update");
    }
}